package com.tledu.mail.controller;

import com.tledu.mail.entity.Mail;
import com.tledu.mail.service.MailService;
import com.tledu.mail.service.impl.MailServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin(origins = "http://localhost")
@RequestMapping("/mail")
public class MailController {
    @Autowired
    private MailServiceImpl mailService;
    @GetMapping("/getMail")
    public List<Mail> getMail(){
        return mailService.getMail();
    }
    @PostMapping("/sendMail")
    public String sendMail(@RequestParam String message){
       return mailService.sendMail(message);
    }
}
